<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      layout:decorate="~{main}"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head>
    <title>服务创建</title>
    <link th:href="@{/localcss/crmlist.css}" href="../static/localcss/crmadd.css" rel="stylesheet">
</head>
<body>
<div layout:fragment="content">
    <div class="">
    <div class="clearfix"></div>
    <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="x_panel">
                <div class="x_title">
                    <h2>服务创建<i class="fa fa-user"></i></h2>
                    <div class="clearfix"></div>
                </div>
                <div class="x_content">
                    <div class="clearfix"></div>
                    <form class="form-horizontal form-label-left" th:action="@{/service/save}" action="/service/save" method="post">
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12"  for="svrCustName"> 客户 <span class="required">*</span></label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <select name="svrCustName" id="svrCustName" class="form-control" required="required">
                                    <option th:each="customer:${customers}" th:value="${customer.custName}" th:text="${customer.custName}" value="">客户</option>
                                </select>
                            </div>
                        </div>
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12"  for="svrType"> 服务类型 <span class="required">*</span></label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <select name="svrType" id="svrType" class="form-control" required="required">
                                    <option th:each="dict:${dicts}" th:value="${dict.dictValue}" th:text="${dict.dictItem}" value="">服务类型</option>
                                </select>
                            </div>
                        </div>
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="svrCreateBy"> 创建人 <span class="required">*</span>
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <input id="svrCreateBy" class="form-control col-md-7 col-xs-12"
                                       data-validate-length-range="10" data-validate-words="1" name="svrCreateBy" required="required"
                                       placeholder="创建人" type="text" th:value="${session.loginUser.usrName}">
                            </div>
                        </div>
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="svrStatus"> 状态 <span class="required">*</span>
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <input id="svrStatus" class="form-control col-md-7 col-xs-12"
                                       data-validate-length-range="10" data-validate-words="1" name="svrStatus"
                                       value="新创建" type="text">
                            </div>
                        </div>
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="svrTitle"> 概要 <span class="required">*</span>
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <input id="svrTitle" class="form-control col-md-7 col-xs-12"
                                       data-validate-length-range="10" data-validate-words="1" name="svrTitle" required="required"
                                       placeholder="概要" type="text">
                            </div>
                        </div>
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="svrCreateDate"> 创建时间 <span class="required">*</span>
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <input id="svrCreateDate" class="form-control date-picker col-md-7 col-xs-12"
                                       data-validate-length-range="10" data-validate-words="1" name="svrCreateDate"
                                       placeholder="创建时间" type="date" disabled>
                            </div>
                        </div>
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="svrRequest"> 服务请求 <span class="required">*</span>
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <textarea id="svrRequest" class="form-control col-md-7 col-xs-12" rows="6"
                                data-validate-length-range="10" data-validate-words="1" name="svrRequest" required="required"></textarea>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-3">
                                <button id="send" type="submit" class="btn btn-success">保存</button>
                                <button type="button" class="btn btn-primary" id="back">返回</button>
                                <br/><br/>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</body>
<script layout:fragment="js">

    var defaultDate = document.querySelectorAll('.date-picker');
    for (var i = 0; i<defaultDate.length; i++) {
        defaultDate[i].valueAsDate = new Date();
    }

    $(document).ready(function(){
        $("#back").on("click",function(){
            window.history.back();
        });
    });
</script>
</html>